function ret=min_distance(mplist,mp)
 d=100000;
 for i=1:length(mplist)
  p=mplist{i};
  if(strcmp(p.view,mp.view)==1)
   ret={p,0,i};
   return;
  endif
  td=distance(p.mat,mp.mat);
  if(td<d)
   d=td;
   ret={p,td,i};
  endif
 endfor
endfunction
